package com.yanzhengwu.boot.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yanzhengwu.boot.entity.Source;
import com.yanzhengwu.boot.service.ISourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * @Auther: yanzhengwu
 * @Date: 2020/6/8 11:17
 * @Description:
 */
@RestController
public class SourceController {


    @Resource
    private ISourceService sourceService;

    @RequestMapping("")
    public String index() {
        LambdaQueryWrapper<Source> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.eq(Source::getId, "test");
        //sourceService.list(queryWrapper);
        //return sourceService.list();
        Source source = new Source();

        source.setCreateTime(new Date());
        source.setName("yzw");
        return String.valueOf( sourceService.insert(source));
        //return sourceService.index().toString();
    }
}